package com.salesmanager.core.business.generic.exception;

/**
 * 应用服务层异常处理类
 */
public class ServiceException extends Exception {

    private static final long serialVersionUID = -6854945379036729034L;
    private int exceptionType = 0;//regular error

    /**
     * 验证失败
     */
    public final static int EXCEPTION_VALIDATION = 99;

    /**
     * 支付拒绝
     */
    public final static int EXCEPTION_PAYMENT_DECLINED = 100;

    /**
     * 交易拒绝
     */
    public final static int EXCEPTION_TRANSACTION_DECLINED = 101;

    /**
     * 账户变更拒绝
     */
    public final static int EXCEPTION_CHANGE_ACCOUNT_DECLINED = 102;

    /**
     * 支付宝账户不存在
     */

    public final static int EXCEPTION_NO_EXIST_USER = 103;

    private String messageCode = null;


    public void setMessageCode(String messageCode) {
        this.messageCode = messageCode;
    }

    public ServiceException() {
        super();
    }

    public ServiceException(String messageCode) {
        super();
        this.messageCode = messageCode;
    }

    public ServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public ServiceException(Throwable cause) {
        super(cause);
    }

    public ServiceException(int exceptionType) {
        super();
        this.exceptionType = exceptionType;
    }

    public ServiceException(int exceptionType, String message) {
        super(message);
        this.exceptionType = exceptionType;
    }

    public ServiceException(int exceptionType, String message, String messageCode) {
        super(message);
        this.messageCode = messageCode;
        this.exceptionType = exceptionType;
    }

    public int getExceptionType() {
        return exceptionType;
    }

    public void setExceptionType(int exceptionType) {
        this.exceptionType = exceptionType;
    }

    public String getMessageCode() {
        return messageCode;
    }

}